<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
        <% String contextPath = request.getContextPath(); request.setAttribute("contextPath", contextPath);%>
            <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
            <html lang="en">

            <head>

                <meta charset="utf-8">
                <meta http-equiv="X-UA-Compatible" content="IE=edge">
                <meta name="viewport" content="width=device-width, initial-scale=1">
                <meta name="description" content="">
                <meta name="author" content="">
                <title>赔率中心</title>

                <!-- Bootstrap Core CSS -->
                <link href="${contextPath}/css/bootstrap.min.css" rel="stylesheet">

                <!-- MetisMenu CSS -->
                <link href="${contextPath}/css/metisMenu.min.css" rel="stylesheet">

                <!-- Custom CSS -->
                <link href="${contextPath}/css/sb-admin-2.min.css" rel="stylesheet">

                <!-- Custom Fonts -->
                <link href="${contextPath}/css/font-awesome.min.css" rel="stylesheet" type="text/css">

                <!--common Css-->
                <link href="${contextPath}/css/common.css" rel="stylesheet">

                <!--oddsCenter Css-->
                <link href="${contextPath}/css/oddsCenter.css" rel="stylesheet">

                <link href="${contextPath}/iconfont/iconfont.css" rel="stylesheet">

            </head>

            <body>

                <div id="wrapper">

                    <%@include file="nav.jsp"%>

                        <div id="page-wrapper">
                            <div class="row">
                                <div class="col-lg-12">
                                    <ul id="myTab" class="nav nav-tabs">
                                        <li class="active">
                                            <a href="#oddsTable" data-toggle="tab">修改赔率</a>
                                        </li>
                                    </ul>
                                    <div id="myTabContent" class="tab-content">
                                        <div class="tab-pane fade in active" id="oddsTable">
                                            <table class="table">
                                                <thead>
                                                    <tr>
                                                        <th>玩法</th>
                                                        <th>下注</th>
                                                        <th>注金(元)</th>
                                                        <th>赔率</th>
                                                        <th>操作</th>
                                                    </tr>
                                                </thead>
                                                <tbody class="game-type-one">
                                                    <c:forEach items="${result.list}" var="item" varStatus="status">

                                                        <tr bgcolor="${item.playwayName=='大小单双玩法'?'transparent':item.playwayName=='猜合'?'#f5f5f5':item.playwayName=='数字玩法'?'transparent':item.playwayName=='数字组合玩法'?'#f5f5f5':'transparent'}">
                                                            <!-- 玩法合并单元格 -->
                                                            <c:if test="${status.index==0}">
                                                                <td rowspan="8 " class="playwayName">${item.playwayName}</td>
                                                            </c:if>
                                                            <c:if test="${status.index==8}">
                                                                <td rowspan="1 " class="playwayName">${item.playwayName}</td>
                                                            </c:if>
                                                            <c:if test="${status.index==9}">
                                                                <td rowspan="5 " class="playwayName">${item.playwayName}</td>
                                                            </c:if>
                                                            <c:if test="${status.index==14}">
                                                                <td rowspan="4 " class="playwayName">${item.playwayName}</td>
                                                            </c:if>
                                                            <c:if test="${status.index==18}">
                                                                <td rowspan="1 " class="playwayName">${item.playwayName}</td>
                                                            </c:if>
                                                            <!-- 下注方式 -->
                                                            <td>${item.betWay}</td>
                                                            <!-- 下注金额合并单元格 -->
                                                            <c:if test="${status.index==0}">
                                                                <td rowspan="8 "><input type="text" class="form-control" id="${item.playwayName}" value="${item.eachMoney}"></td>
                                                            </c:if>
                                                            <c:if test="${status.index==8}">
                                                                <td rowspan="1 "><input type="text" class="form-control" id="${item.playwayName}" value="${item.eachMoney}"></td>
                                                            </c:if>
                                                            <c:if test="${status.index==9}">
                                                                <td rowspan="5 "><input type="text" class="form-control" id="${item.playwayName}" value="${item.eachMoney}"></td>
                                                            </c:if>
                                                            <c:if test="${status.index==14}">
                                                                <td rowspan="4 "><input type="text" class="form-control" id="${item.playwayName}" value="${item.eachMoney}"></td>
                                                            </c:if>
                                                            <c:if test="${status.index==18}">
                                                                <td rowspan="1 "><input type="text" class="form-control" id="${item.playwayName}" value="${item.eachMoney}"></td>
                                                            </c:if>
                                                            <!-- 赔率 -->
                                                            <td><input type="text" class="form-control" id="${item.betWay}" value="${item.odds} "></td>
                                                            <!-- 操作方式 -->
                                                            <td><a href="javascript:updateOdds('${item.playwayName}','${item.betWay}',$('#${item.playwayName}').val(),$('#${item.betWay}').val())">保存</a></td>
                                                        </tr>
                                                    </c:forEach>
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                </div>
                                <!-- /.col-lg-12 -->
                            </div>

                        </div>
                        <!-- /#page-wrapper -->

                </div>
                <!-- /#wrapper -->


                <!-- jQuery -->
                <script src="${contextPath}/js/jquery.min.js "></script>

                <!-- Bootstrap Core JavaScript -->
                <script src="${contextPath}/js/bootstrap.min.js "></script>

                <!-- Metis Menu Plugin JavaScript -->
                <script src="${contextPath}/js/metisMenu.min.js "></script>

                <!-- Custom Theme JavaScript -->
                <script src="${contextPath}/js/sb-admin-2.min.js "></script>

                <!-- Page-Level Demo Scripts - Tables - Use for reference -->
                <script type="text/javascript">
                    function updateOdds(playwayName, betWay, eachMoney,odds) {

                        //获取每一注的金额
                        $.ajax({
                            type: 'POST',
                            url: '${contextPath}/WebManager/odds/oddsCenter',
                            data: {
                                playwayName: playwayName,
                                betWay: betWay,
                                eachMoney: eachMoney,
                                odds: odds,
                            },
                            dataType: 'json',
                            success: function(data) {
                                if (data.status != 1 ) {
                                    alert("修改成功！");
                                    window.location.href = "${contextPath}/WebManager/odds/showOddsCenter";
                                } else {
                                    alert("修改失败！");
                                }
                            },
                        });
                    }

                    $(function() {
                        //        表格隔行变色
                        $('.tab-content tbody').each(function(index, item) {
                            if (index % 2 === 0) {
                                $(this).css({
                                    backgroundColor: "transparent "
                                });
                            } else {
                                $(this).css({
                                    backgroundColor: "#f5f5f5"
                                });
                            }
                        });
                        console.log($('.form-control'));

                        //提示信息封装函数
                        function notice(notice) {
                            var str = '';
                            str += '<div class="popupTip ">';
                            str += notice;
                            str += '<span class="glyphicon glyphicon-remove "></span>';
                            str += '</div>';
                            str += '</strong></div>';
                            //wrapper插入str
                            $("#wrapper ").append(str);
                        }

                        //取消提示框
                        $("#wrapper ").on('click', '.glyphicon-remove', function() {
                            $(".popupTip ").hide();
                        });
                    })
                </script>
            </body>

            </html>